:root {
    --primary: #3498db;
    --secondary: #2c3e50;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --light: #f8f9fa;
    --dark: #343a40;
    --gray: #6c757d;
    --border-radius: 6px;
    --box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

/* ========== 基础样式 ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.5;
    padding: 15px;
    min-height: 100vh;
    font-size: 14px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ========== 头部样式 ========== */
header {
    text-align: center;
    padding: 15px 0 20px;
    position: relative;
}

.header-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
}

h1 {
    color: var(--secondary);
    font-size: 2.2rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 600;
}

h1 i {
    color: var(--primary);
    font-size: 2rem;
}

/* ========== 状态栏样式 ========== */
.status-bar {
    display: flex;
    justify-content: space-between;
    background: white;
    border-radius: var(--border-radius);
    padding: 12px 20px;
    margin-bottom: 20px;
    box-shadow: var(--box-shadow);
    font-size: 0.9rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success);
}

.status-indicator.warning {
    background: var(--warning);
    animation: pulse 2s infinite;
}

.status-indicator.danger {
    background: var(--danger);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(243, 156, 18, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(243, 156, 18, 0);
    }
}

/* ========== 当前配置信息栏 ========== */
.current-config-bar {
    display: flex;
    justify-content: space-around;
    background: #e3f2fd;
    border-radius: var(--border-radius);
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: var(--box-shadow);
    border: 1px solid #bbdefb;
}

.config-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.config-info i {
    color: var(--primary);
    font-size: 1.2rem;
}

.config-info strong {
    color: var(--secondary);
    font-weight: 600;
}

/* ========== 暂停状态信息样式 ========== */
.pause-status-info {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffc107;
    border-left: 4px solid #f39c12;
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 15px 0;
    box-shadow: var(--box-shadow);
    animation: pulse-glow 2s infinite alternate;
}

.pause-status-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(243, 156, 18, 0.3);
}

.pause-status-header i {
    font-size: 1.5rem;
    color: var(--warning);
}

.pause-status-header h3 {
    margin: 0;
    color: var(--secondary);
    font-size: 1.2rem;
    font-weight: 600;
}

.pause-status-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.pause-status-content .status-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pause-status-content .status-item label {
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.9rem;
}

.pause-status-content .status-item span {
    background: white;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid rgba(243, 156, 18, 0.3);
    font-size: 0.9rem;
    color: var(--dark);
}

@keyframes pulse-glow {
    0% {
        box-shadow: var(--box-shadow);
    }
    100% {
        box-shadow: 0 2px 12px rgba(243, 156, 18, 0.3), 0 0 20px rgba(243, 156, 18, 0.1);
    }
}

/* ========== 通知消息样式 ========== */
.message {
    background: var(--success);
    color: white;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: 500px;
    min-width: 300px;
    transition: var(--transition);
}

.message.error {
    background: var(--danger);
}

/* ========== 主面板样式 ========== */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.card-icon {
    width: 45px;
    height: 45px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.card-icon i {
    font-size: 1.6rem;
    color: var(--primary);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary);
}

.tip {
    background: #f8f9fa;
    border-left: 3px solid var(--primary);
    padding: 12px 15px;
    margin: 12px 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-size: 0.9rem;
    flex-grow: 1;
}

.tip ol {
    padding-left: 20px;
    margin-top: 8px;
}

.tip li {
    margin-bottom: 6px;
    line-height: 1.4;
}

.action-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px dashed #eee;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--dark);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ========== 按钮样式 ========== */
button {
    padding: 10px 22px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

button.primary {
    background: var(--primary);
    color: white;
}

button.primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

button.success {
    background: var(--success);
    color: white;
}

button.success:hover {
    background: #219653;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

button.warning {
    background: var(--warning);
    color: white;
}

button.warning:hover {
    background: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

button.danger {
    background: var(--danger);
    color: white;
}

button.danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

button.secondary {
    background: var(--gray);
    color: white;
}

button.secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button:disabled {
    background: #ced4da;
    cursor: not-allowed;
    opacity: 0.7;
}

.modal-btn {
    background: #e9ecef;
    color: var(--dark);
    padding: 8px 15px;
    margin: 12px 0;
    width: 100%;
    text-align: center;
    font-size: 1rem;
}

.modal-btn:hover {
    background: #dee2e6;
}

/* ========== 控制面板样式 ========== */
.control-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.control-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.control-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.control-card h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--secondary);
}

/* ========== 模态框样式 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 0;
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 1000px;
    margin: 20px auto;
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, #2980b9 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.6rem;
    cursor: pointer;
    padding: 4px 12px;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: white;
    z-index: 10;
    border-radius: 0 0 8px 8px;
}

/* ========== 配置管理区域样式 ========== */
.config-manage-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.config-manage-section h4 {
    margin: 0 0 15px 0;
    color: var(--secondary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 12px;
}

.form-group {
    flex: 1;
    min-width: 220px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--dark);
    font-weight: 500;
    font-size: 0.9rem;
}

.button-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ========== 试剂配置表格样式 ========== */
.reagent-table-wrapper {
    overflow-x: auto;
    margin-bottom: 15px;
}

.reagent-table {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    background: white;
    width: 100%;
}

.reagent-table-body {
    max-height: 400px; /* 降低高度，确保所有端口可见 */
    overflow-y: auto;
}

.reagent-table-body::-webkit-scrollbar {
    width: 8px;
}

.reagent-table-body::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.reagent-table-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.reagent-table-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.reagent-row {
    display: grid;
    grid-template-columns: 60px 1fr 120px;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    gap: 15px;
}

.reagent-row:last-child {
    border-bottom: none;
}

.reagent-row.header {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--secondary);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid #dee2e6;
}

.port-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, var(--primary) 0%, #2980b9 100%);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.reagent-row input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    width: 100%;
}

.reagent-row input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.reagent-row input:read-only {
    background: #f8f9fa;
    color: var(--gray);
}

.port-desc {
    font-size: 0.85rem;
    color: var(--gray);
}

/* ========== 步骤表格样式 ========== */
.steps-table {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    background: white;
}

#steps-container {
    max-height: 400px;
    overflow-y: auto;
}

#steps-container::-webkit-scrollbar {
    width: 8px;
}

#steps-container::-webkit-scrollbar-track {
    background: #f8f9fa;
}

#steps-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#steps-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.steps-header-row {
    display: grid;
    grid-template-columns: 60px 1fr 80px 120px 80px 100px;
    gap: 10px;
    padding: 12px 15px;
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--secondary);
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

.step-row {
    display: grid;
    grid-template-columns: 60px 1fr 80px 120px 80px 100px;
    gap: 10px;
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
    transition: var(--transition);
}

.step-row:hover {
    background: #f8f9fa;
    transform: translateX(2px);
}

.step-row:last-child {
    border-bottom: none;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--success) 0%, #219653 100%);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.step-row select,
.step-row input {
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.85rem;
    width: 100%;
}

.step-row select:focus,
.step-row input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.step-actions {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.step-action-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75rem;
    color: white;
    transition: var(--transition);
}

.step-action-btn.up {
    background: var(--warning);
}

.step-action-btn.down {
    background: var(--warning);
}

.step-action-btn.delete {
    background: var(--danger);
}

.step-action-btn:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.step-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.empty-steps-row {
    padding: 0;
}

/* ========== 表单样式 ========== */
input, select {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    width: 100%;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

input.success {
    border-color: var(--success);
    background-color: rgba(39, 174, 96, 0.05);
}

input.error {
    border-color: var(--danger);
    background-color: rgba(231, 76, 60, 0.05);
}

/* ========== 信息提示框 ========== */
.info-box {
    background: #e3f2fd;
    border-left: 4px solid var(--primary);
    padding: 12px 16px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-box i {
    color: var(--primary);
}

.divider {
    border-top: 1px solid #dee2e6;
    margin: 15px 0;
}

/* ========== 加载动画 ========== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== 响应式设计 ========== */
@media (max-width: 1200px) {
    .modal-content {
        max-width: 95%;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 13px;
    }

    .dashboard {
        grid-template-columns: 1fr;
    }

    .status-bar {
        flex-direction: column;
        gap: 10px;
    }

    .current-config-bar {
        flex-direction: column;
        gap: 10px;
    }

    .form-row {
        flex-direction: column;
    }

    .form-group {
        min-width: 100%;
    }

    .button-group {
        width: 100%;
        justify-content: space-between;
    }

    h1 {
        font-size: 1.8rem;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .card {
        padding: 15px;
    }

    .tip {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .pause-status-content {
        grid-template-columns: 1fr;
    }

    .reagent-row {
        grid-template-columns: 50px 1fr;
    }

    .port-desc {
        display: none;
    }

    .steps-header-row,
    .step-row {
        grid-template-columns: 40px 1fr 60px 80px;
    }

    .step-row input[name*="_temperature"],
    .steps-header-row span:nth-child(5) {
        display: none;
    }

    .control-panel {
        grid-template-columns: 1fr;
    }
}